pip installs packages successfully, but executables not found from command line

后端 未结 9 2451
感情败类
感情败类 2020-12-07 13:44

I am working on mac OS X Yosemite, version 10.10.3.

I installed python2.7 and pip using macport as done in http://johnlaudun.org/20150512-installing-and-setting-pip

相关标签:
9条回答
  • 2020-12-07 14:16

    I stumbled upon this question because I created, successfully built and published a PyPI Package, but couldn't execute it after installation. The $PATHvariable was correctly set.

    In my case the problem was that I hadn't set the entry_pointin the setup.py file:

    entry_points = {'console_scripts':
    
    ['YOUR_CONSOLE_COMMAND=MODULE_NAME.FILE_NAME:FUNCTION_NAME'],},
    
    0 讨论(0)
  • 2020-12-07 14:22

    On Windows, you need to add the path %USERPROFILE%\AppData\Roaming\Python\Scripts to your path.

    0 讨论(0)
  • 2020-12-07 14:23

    When you install Python or Python3 using MacOS installer (downloaded from Python website) - it adds an exporter to your ~/.profile script. All you need to do is just source it. Restarting all the terminals should also do the trick.

    WARNING - I believe it's better to just use pip3 with Python3 - for future benefits.

    If you already have Python3 installed, the following steps work for me on macOS Mojave:

    1. Install ansible first using sudo - sudo -H pip3 install ansible

    2. you create a symlink to the Python's bin path

    sudo ln -s /Library/Frameworks/Python.framework/Versions/Current/bin /Library/Frameworks/Python.framework/current_python_bin

    and staple it to .profile

    export PATH=$PATH:/Library/Frameworks/Python.framework/current_python_bin

    1. run source ~/.profile and restart all terminal shells.

    2. Type ansible --version

    0 讨论(0)
提交回复
热议问题