简体   繁体   中英

sudo install - Python 3?

I'm new to Linux and I'm trying to install packages through a Makefile so users can run my Python 3 program.

sudo pip install python3-weather-api

However, even after uninstalling a previously installed version, the package seems to be going to the 2.7 version of Python.

Requirement already satisfied: python3-weather-api in /usr/local/lib/python2.7/dist-packages

Then, when I run the program, it can't find the module (it works locally in Python 3 just fine).

 SystemExit: 1
 Traceback (most recent call last):
   File "project.py", line 11, in <module>
     from weather import Weather
 ImportError: No module named 'weather'

Is there a way I can point the original installation so when I run python3 project.py it can find the module?

Thanks very much!

我建议您使用pyenv来管理Python安装,但现在尝试运行: sudo pip3 install python3-weather-api

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM